from selenium import webdriver
import time
import re
from unittest import TestCase
from selenium.webdriver.common.by import By

class expt2():
   def expt1(self):
       expect = "后台管理系统"
       driver = webdriver.Chrome()
       driver.maximize_window()
       driver.get("http://localhost:90/")
       time.sleep(1)

       ele1 = driver.find_element(By.ID, "username").send_keys("lisi")
       time.sleep(1)
       ele1 = driver.find_element(By.ID, "password").send_keys("123456")
       time.sleep(1)
       ele1 = driver.find_element(By.ID, "login_btn").click()
       time.sleep(1)
       ele1 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/a').click()
       time.sleep(1)
       ele1 = driver.find_element(By.XPATH, '/html/body/div/div/aside/div[2]/nav/ul/li[4]/ul/li[3]/a').click()

       result = driver.find_element(By.XPATH, '/html/body/div/div/main/div/div/div[2]/div/div/div[2]/h4[2]').text
       driver.quit()
       str2 = ''.join(re.findall('[0-9]', result))
       str2 = int(str2) / 100
       return str2











